unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtDlgs, ComCtrls, ExtCtrls, Buttons;

type
  TfmDialog = class(TForm)
    pnDraw: TPanel;
    pnText: TPanel;
    btDraw: TButton;
    btLoadText: TButton;
    btSaveText: TButton;
    BitBtn1: TBitBtn;
    imDraw: TImage;
    reText: TRichEdit;
    odText: TOpenDialog;
    odDraw: TOpenPictureDialog;
    sdText: TSaveDialog;
    procedure btDrawClick(Sender: TObject);
    procedure btLoadTextClick(Sender: TObject);
    procedure btSaveTextClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmDialog: TfmDialog;

implementation

{$R *.dfm}

procedure TfmDialog.btDrawClick(Sender: TObject);
var
  fname: string;
begin
  if odDraw.Execute then
  begin
    fname := odDraw.FileName;
    imDraw.Picture.LoadFromFile(fname);
  end;
end;

procedure TfmDialog.btLoadTextClick(Sender: TObject);
var
  fname: string;
begin
  if odText.Execute then
  begin
    fname := odText.FileName;
    reText.Lines.LoadFromFile(fname);
  end;
end;

procedure TfmDialog.btSaveTextClick(Sender: TObject);
var
  fname: string;
begin
  sdText.FileName:=fname;
  if sdText.Execute then
  begin
    fname:=sdText.FileName;
    reText.Lines.SaveToFile(fname);
  end;
end;

end.
